#ifndef CWORKER_H
#define CWORKER_H

#include <QObject>
#include <QThread>
#include <QMutex>
#include <QVector>
#include <QPoint>

#include "CGridMap.h"
#include "CPathPlanRRT.h"

class CWorker : public QObject
{
    Q_OBJECT
public:
    explicit CWorker(QObject *parent = nullptr);

    ~CWorker();

public slots:

    void createObject();

    void slotUpdateGridMapSize(quint16 height, quint16 width);
    void slotUpdateGridMapData(QVector<QPoint> data);
    void slotResetGridMapData();

    void slotSetStartPoint(QPoint);
    void slotSetDestPoint(QPoint);

    void slotStartPlanning();


signals:

    void signalDisplayRandomPoint(QPoint point);
    void signalDisplayTreeNode(TNode node);
    void signalDisplayOriginPath(QVector<QPoint>);

private:

    CGridMap * m_map_manager = nullptr;

    CPathPlanRRT * m_rrt = nullptr;

    std::unique_ptr<QMutex> m_mutex;

};

#endif // CWORKER_H
